import numpy as np
import matplotlib.pyplot as plt
import math

plt.figure() # Create a new figure window
MaxPoint = 200
AngleIn  =  np.linspace(0.0, 2*math.pi, num = MaxPoint) # Create 1-D arrays for x,y dimensions
xlist 	 = np.zeros(len(AngleIn))
ylist	 = np.zeros(len(AngleIn))
xout 	 = np.zeros(len(AngleIn))
yout	 = np.zeros(len(AngleIn))
OutAngle = np.zeros(len(AngleIn))
xoutlist = np.zeros(len(AngleIn))
youtlist = np.zeros(len(AngleIn))

for i in np.linspace(0,len(AngleIn)-1,MaxPoint):
	xlist[i] = (i/len(AngleIn))*math.cos(AngleIn[i])
	ylist[i] = (i/len(AngleIn))*math.sin(AngleIn[i])
	if xlist[i] == 0:
		xlist[i] = 0.001
	if ylist[i] == 0:
		ylist[i] = 0.001
	if (xlist[i] > 0)&(ylist[i]>0): # 1st Quad
		OutAngle[i] = math.atan(ylist[i]/xlist[i])
	if (xlist[i] < 0)&(ylist[i]>0): # 2nd Quad
		OutAngle[i] = math.atan(ylist[i]/xlist[i]) + math.pi
	if (xlist[i]< 0)&(ylist[i]<0): # 3rd Quad
		OutAngle[i] = math.atan(ylist[i]/xlist[i]) + math.pi
	if (xlist[i] > 0)&(ylist[i]<0): # 4th Quad
		OutAngle[i] = math.atan(ylist[i]/xlist[i]) + 2*math.pi

	
	print i, AngleIn[i]*180/math.pi,(OutAngle[i])*180/math.pi
	#print i, AngleIn[i],(OutAngle[i])
	xout[i] = ((i+10)/len(AngleIn))*math.cos(OutAngle[i])
	yout[i] = ((i+10)/len(AngleIn))*math.sin(OutAngle[i])
	
X,Y = np.meshgrid(xlist, ylist) # Create 2-D grid xlist,ylist values
# plt.scatter(X,Y, s = 1, c = 'r', marker = '.')
plt.scatter(xlist,ylist, s = 20, c = 'r', marker = '+')
plt.scatter(xout ,yout , s = 20, c = 'b', marker = '+')

# Z = np.sqrt(X**2 + Y**2) # Compute function values on the grid
# plt.contour(X, Y, Z, [0.5, 1.0, 1.2, 1.5], colors = 'k', linestyles = 'solid')
plt.axes().set_aspect('equal') # Scale the plot size to get same aspect ratio
# plt.axis([0, 1.0, 0, 1.0]) # Change axis limits
plt.show()